#!/bin/bash
runner='python'
bgpmon_procid=`ps ax | grep bgpmon | grep $runner | awk '{printf "%s ", $1}'`
if [ "$bgpmon_procid" != "" ]; then
  sudo kill -9 $bgpmon_procid
fi

current_dir="/home/yangy/argus_yy/"

if [ -f $current_dir/nohup.out ]; then
  cat $current_dir/nohup.out >> $current_dir/log/`date +%Y%m | awk '{printf "%s", $1}'`.log
fi

if [ "$1" != "STOP" ]; then
  nohup $runner $current_dir/bgpmon.py > $current_dir/nohup.out 2>&1 &
fi
